package com.gitee.huxing.course.domain.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.gitee.huxing.course.domain.mapper.PlatFormOrderMapper;
import com.gitee.huxing.course.domain.module.PlatFormOrderDO;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;

/**
 * @Description: 订单服务
 * @ProjectName: JavaCourse
 * @Package: com.gitee.huxing.course.domain.service
 * @ClassName: OrderService
 * @Author: huxing
 * @DateTime: 2021-10-18 下午6:11
 */
@CacheConfig(cacheNames = "OrderCache")
public interface OrderService extends IService<PlatFormOrderDO> {

    @CachePut(key = "#orderDO.getOrderId()")
    PlatFormOrderDO insert(PlatFormOrderDO orderDO) throws RuntimeException;

    @CachePut(key = "#orderDO.getOrderId()")
    PlatFormOrderDO update(PlatFormOrderDO orderDO) throws RuntimeException;

    @CacheEvict(key = "#orderId")
    int delete(String orderId) throws RuntimeException;

    @Cacheable(key = "#orderId")
    PlatFormOrderDO getOrderById(String orderId) throws RuntimeException;
}
